package com.hsc.yalebao.face;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout.LayoutParams;
import com.facebook.drawee.view.SimpleDraweeView;
import com.hsc.yalebao.base.CustomApplication;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

public class EmojiFragment extends Fragment
{
  public static final String BASE_URL = "asset:///";
  private GridViewAdapter adapter;
  private List<FaceBean> faces = new ArrayList();
  private MyGridView gridview;
  private Handler handler;

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    View localView = paramLayoutInflater.inflate(2130903126, null);
    this.gridview = ((MyGridView)localView.findViewById(2131099657));
    this.adapter = new GridViewAdapter(null);
    this.gridview.setAdapter(this.adapter);
    System.out.println(this.faces.size() + "条目数量");
    this.gridview.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          Message localMessage = new Message();
          localMessage.obj = (((FaceBean)EmojiFragment.this.faces.get(paramAnonymousInt)).getImageName() + ".gif");
          EmojiFragment.this.handler.sendMessage(localMessage);
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    return localView;
  }

  public void onViewCreated(View paramView, Bundle paramBundle)
  {
    super.onViewCreated(paramView, paramBundle);
  }

  public void setFaces(List<FaceBean> paramList)
  {
    this.faces = paramList;
  }

  public void setHandler(Handler paramHandler)
  {
    this.handler = paramHandler;
  }

  private class GridViewAdapter extends BaseAdapter
  {
    private GridViewAdapter()
    {
    }

    public int getCount()
    {
      return EmojiFragment.this.faces.size();
    }

    public Object getItem(int paramInt)
    {
      return EmojiFragment.this.faces.get(paramInt);
    }

    public long getItemId(int paramInt)
    {
      return paramInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      if (paramView == null)
        paramView = LayoutInflater.from(EmojiFragment.this.getActivity()).inflate(2130903130, null);
      SimpleDraweeView localSimpleDraweeView = (SimpleDraweeView)ViewHolder.get(paramView, 2131100130);
      RelativeLayout.LayoutParams localLayoutParams = (RelativeLayout.LayoutParams)localSimpleDraweeView.getLayoutParams();
      localLayoutParams.width = CustomApplication.app.displayMetrics.widthPixels;
      localSimpleDraweeView.setLayoutParams(localLayoutParams);
      localSimpleDraweeView.setAspectRatio(1.0F);
      String str = "asset:///" + ((FaceBean)EmojiFragment.this.faces.get(paramInt)).getImageName() + ".gif";
      localSimpleDraweeView.setImageURI(str);
      System.out.println("加载本地图片" + str);
      return paramView;
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.face.EmojiFragment
 * JD-Core Version:    0.6.2
 */